package com.song;

import com.song.service.MyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class Application implements CommandLineRunner {

    @Autowired
    private MyService myService;
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Application.class, args);
//        MyService service = (MyService) run.getBean("oneService");
//        service.print();
        System.out.println("容易创建完成");
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("容器还没有创建完成");
        myService.print();
    }
}
